
#include <sstream>
#include "cmd_obj.h"
#include "cgi_stub_cntl.h"
#include "cooperatordao_stub4web.h"
#include "cooperatordao_req_resp.h"


using namespace b2b2c::cooperator::dao;

	uint32_t CCooperatorDaoStub4Web::CheckCooperatorPassWd(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint64_t cooperatorId,
				const std::string& cooperatorPassword,
				const std::string& inReserve,
				std::string& errmsg,
				std::string& outReserve
	)
	{
		CCgiStubCntl oCgiStubCntl;
		oCgiStubCntl.Initialize_r();
		this->SetCgiStubCntl(&oCgiStubCntl);
	
	    CCooperatorDaoCheckCooperatorPassWdReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.cooperatorId = cooperatorId;
			oReq.cooperatorPassword = cooperatorPassword;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.outReserve = outReserve;
	
	    oCgiStubCntl.setPassport(
	        rCntlInfo.getOperatorUin(), 
	        rCntlInfo.getOperatorKey().c_str(),
	        rCntlInfo.getOperatorClientIP());
	
		if(const_cast<CCntlInfo&>(rCntlInfo).isRouteKeySet())	
			oCgiStubCntl.setUin(const_cast<CCntlInfo&>(rCntlInfo).getRouteKey());	
	    
	    if(oCgiStubCntl.putSvcObj(&oReq, 0) != 0)
	    {
			m_sErrMsg = "DoRequest failed.";
	        return 0xFFF1;
	    }
	    
	    // Send & Recv
		int iRetCode = 0;
		if((iRetCode = SendRecv()) != 0)
		{
			if(99 == iRetCode) // UDP & Need No Response
				return 0;
	
			std::stringstream oss;
			oss << m_lTimeout;
	        m_sErrMsg = "Send & Recv Timeout(";
			m_sErrMsg += oss.str();
			m_sErrMsg += "s) ";
			m_sErrMsg += oCgiStubCntl.GetLastErrMsg();
			return oCgiStubCntl.getCmd(); // Example : 0xf100
	    }
	    
		if(!m_poCmd->isValid(COOPERATORDAO_CHECKCOOPERATORPASSWD_RESP_CMD_ID))
	    {
	        m_sErrMsg = "Cmd not match for COOPERATORDAO_CHECKCOOPERATORPASSWD_RESP_CMD_ID";
	        return 0xFFF3;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    m_poCmd->getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CCooperatorDaoCheckCooperatorPassWdResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xFFF4;
	    }
	    
			errmsg  = oResp.errmsg;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	uint32_t CCooperatorDaoStub4Web::DeleteCooperatorMonitorModel(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t cooperatorId,
				uint32_t modelId,
				const std::string& inReserve,
				std::string& errmsg,
				std::string& outReserve
	)
	{
		CCgiStubCntl oCgiStubCntl;
		oCgiStubCntl.Initialize_r();
		this->SetCgiStubCntl(&oCgiStubCntl);
	
	    CCooperatorDaoDeleteCooperatorMonitorModelReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.cooperatorId = cooperatorId;
			oReq.modelId = modelId;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.outReserve = outReserve;
	
	    oCgiStubCntl.setPassport(
	        rCntlInfo.getOperatorUin(), 
	        rCntlInfo.getOperatorKey().c_str(),
	        rCntlInfo.getOperatorClientIP());
	
		if(const_cast<CCntlInfo&>(rCntlInfo).isRouteKeySet())	
			oCgiStubCntl.setUin(const_cast<CCntlInfo&>(rCntlInfo).getRouteKey());	
	    
	    if(oCgiStubCntl.putSvcObj(&oReq, 0) != 0)
	    {
			m_sErrMsg = "DoRequest failed.";
	        return 0xFFF1;
	    }
	    
	    // Send & Recv
		int iRetCode = 0;
		if((iRetCode = SendRecv()) != 0)
		{
			if(99 == iRetCode) // UDP & Need No Response
				return 0;
	
			std::stringstream oss;
			oss << m_lTimeout;
	        m_sErrMsg = "Send & Recv Timeout(";
			m_sErrMsg += oss.str();
			m_sErrMsg += "s) ";
			m_sErrMsg += oCgiStubCntl.GetLastErrMsg();
			return oCgiStubCntl.getCmd(); // Example : 0xf100
	    }
	    
		if(!m_poCmd->isValid(COOPERATORDAO_DELETECOOPERATORMONITORMODEL_RESP_CMD_ID))
	    {
	        m_sErrMsg = "Cmd not match for COOPERATORDAO_DELETECOOPERATORMONITORMODEL_RESP_CMD_ID";
	        return 0xFFF3;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    m_poCmd->getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CCooperatorDaoDeleteCooperatorMonitorModelResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xFFF4;
	    }
	    
			errmsg  = oResp.errmsg;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	uint32_t CCooperatorDaoStub4Web::GetCooperatorBaseInfo(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint64_t cooperatorId,
				const std::string& inReserve,
				std::string& errmsg,
				b2b2c::cooperator::ddo::CCooperatorBaseInfoDdo& cooperatorBaseInfoDdo,
				std::string& outReserve
	)
	{
		CCgiStubCntl oCgiStubCntl;
		oCgiStubCntl.Initialize_r();
		this->SetCgiStubCntl(&oCgiStubCntl);
	
	    CCooperatorDaoGetCooperatorBaseInfoReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.cooperatorId = cooperatorId;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.cooperatorBaseInfoDdo = cooperatorBaseInfoDdo;
			oReq.outReserve = outReserve;
	
	    oCgiStubCntl.setPassport(
	        rCntlInfo.getOperatorUin(), 
	        rCntlInfo.getOperatorKey().c_str(),
	        rCntlInfo.getOperatorClientIP());
	
		if(const_cast<CCntlInfo&>(rCntlInfo).isRouteKeySet())	
			oCgiStubCntl.setUin(const_cast<CCntlInfo&>(rCntlInfo).getRouteKey());	
	    
	    if(oCgiStubCntl.putSvcObj(&oReq, 0) != 0)
	    {
			m_sErrMsg = "DoRequest failed.";
	        return 0xFFF1;
	    }
	    
	    // Send & Recv
		int iRetCode = 0;
		if((iRetCode = SendRecv()) != 0)
		{
			if(99 == iRetCode) // UDP & Need No Response
				return 0;
	
			std::stringstream oss;
			oss << m_lTimeout;
	        m_sErrMsg = "Send & Recv Timeout(";
			m_sErrMsg += oss.str();
			m_sErrMsg += "s) ";
			m_sErrMsg += oCgiStubCntl.GetLastErrMsg();
			return oCgiStubCntl.getCmd(); // Example : 0xf100
	    }
	    
		if(!m_poCmd->isValid(COOPERATORDAO_GETCOOPERATORBASEINFO_RESP_CMD_ID))
	    {
	        m_sErrMsg = "Cmd not match for COOPERATORDAO_GETCOOPERATORBASEINFO_RESP_CMD_ID";
	        return 0xFFF3;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    m_poCmd->getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CCooperatorDaoGetCooperatorBaseInfoResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xFFF4;
	    }
	    
			errmsg  = oResp.errmsg;
			cooperatorBaseInfoDdo  = oResp.cooperatorBaseInfoDdo;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	uint32_t CCooperatorDaoStub4Web::GetCooperatorKey(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint64_t cooperatorId,
				const std::string& inReserve,
				std::string& errmsg,
				std::string& sCooperatorKey,
				std::string& outReserve
	)
	{
		CCgiStubCntl oCgiStubCntl;
		oCgiStubCntl.Initialize_r();
		this->SetCgiStubCntl(&oCgiStubCntl);
	
	    CCooperatorDaoGetCooperatorKeyReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.cooperatorId = cooperatorId;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.sCooperatorKey = sCooperatorKey;
			oReq.outReserve = outReserve;
	
	    oCgiStubCntl.setPassport(
	        rCntlInfo.getOperatorUin(), 
	        rCntlInfo.getOperatorKey().c_str(),
	        rCntlInfo.getOperatorClientIP());
	
		if(const_cast<CCntlInfo&>(rCntlInfo).isRouteKeySet())	
			oCgiStubCntl.setUin(const_cast<CCntlInfo&>(rCntlInfo).getRouteKey());	
	    
	    if(oCgiStubCntl.putSvcObj(&oReq, 0) != 0)
	    {
			m_sErrMsg = "DoRequest failed.";
	        return 0xFFF1;
	    }
	    
	    // Send & Recv
		int iRetCode = 0;
		if((iRetCode = SendRecv()) != 0)
		{
			if(99 == iRetCode) // UDP & Need No Response
				return 0;
	
			std::stringstream oss;
			oss << m_lTimeout;
	        m_sErrMsg = "Send & Recv Timeout(";
			m_sErrMsg += oss.str();
			m_sErrMsg += "s) ";
			m_sErrMsg += oCgiStubCntl.GetLastErrMsg();
			return oCgiStubCntl.getCmd(); // Example : 0xf100
	    }
	    
		if(!m_poCmd->isValid(COOPERATORDAO_GETCOOPERATORKEY_RESP_CMD_ID))
	    {
	        m_sErrMsg = "Cmd not match for COOPERATORDAO_GETCOOPERATORKEY_RESP_CMD_ID";
	        return 0xFFF3;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    m_poCmd->getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CCooperatorDaoGetCooperatorKeyResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xFFF4;
	    }
	    
			errmsg  = oResp.errmsg;
			sCooperatorKey  = oResp.sCooperatorKey;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	uint32_t CCooperatorDaoStub4Web::GetCooperatorLicense(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint64_t cooperatorId,
				const std::set<uint8_t >& licenseType,
				const std::string& inReserve,
				std::string& errmsg,
				std::vector<b2b2c::cooperator::ddo::CCooperatorLicenseDdo >& cooperatorLicenseDdo,
				std::string& outReserve
	)
	{
		CCgiStubCntl oCgiStubCntl;
		oCgiStubCntl.Initialize_r();
		this->SetCgiStubCntl(&oCgiStubCntl);
	
	    CCooperatorDaoGetCooperatorLicenseReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.cooperatorId = cooperatorId;
			oReq.licenseType = licenseType;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.cooperatorLicenseDdo = cooperatorLicenseDdo;
			oReq.outReserve = outReserve;
	
	    oCgiStubCntl.setPassport(
	        rCntlInfo.getOperatorUin(), 
	        rCntlInfo.getOperatorKey().c_str(),
	        rCntlInfo.getOperatorClientIP());
	
		if(const_cast<CCntlInfo&>(rCntlInfo).isRouteKeySet())	
			oCgiStubCntl.setUin(const_cast<CCntlInfo&>(rCntlInfo).getRouteKey());	
	    
	    if(oCgiStubCntl.putSvcObj(&oReq, 0) != 0)
	    {
			m_sErrMsg = "DoRequest failed.";
	        return 0xFFF1;
	    }
	    
	    // Send & Recv
		int iRetCode = 0;
		if((iRetCode = SendRecv()) != 0)
		{
			if(99 == iRetCode) // UDP & Need No Response
				return 0;
	
			std::stringstream oss;
			oss << m_lTimeout;
	        m_sErrMsg = "Send & Recv Timeout(";
			m_sErrMsg += oss.str();
			m_sErrMsg += "s) ";
			m_sErrMsg += oCgiStubCntl.GetLastErrMsg();
			return oCgiStubCntl.getCmd(); // Example : 0xf100
	    }
	    
		if(!m_poCmd->isValid(COOPERATORDAO_GETCOOPERATORLICENSE_RESP_CMD_ID))
	    {
	        m_sErrMsg = "Cmd not match for COOPERATORDAO_GETCOOPERATORLICENSE_RESP_CMD_ID";
	        return 0xFFF3;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    m_poCmd->getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CCooperatorDaoGetCooperatorLicenseResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xFFF4;
	    }
	    
			errmsg  = oResp.errmsg;
			cooperatorLicenseDdo  = oResp.cooperatorLicenseDdo;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	uint32_t CCooperatorDaoStub4Web::GetCooperatorMonitorModel(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t cooperatorId,
				uint32_t modelId,
				const std::string& inReserve,
				std::string& errmsg,
				b2b2c::cooperator::ddo::CCooperatorMonitorModelDdo& CooperatorMonitorModelDdo,
				std::string& outReserve
	)
	{
		CCgiStubCntl oCgiStubCntl;
		oCgiStubCntl.Initialize_r();
		this->SetCgiStubCntl(&oCgiStubCntl);
	
	    CCooperatorDaoGetCooperatorMonitorModelReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.cooperatorId = cooperatorId;
			oReq.modelId = modelId;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.CooperatorMonitorModelDdo = CooperatorMonitorModelDdo;
			oReq.outReserve = outReserve;
	
	    oCgiStubCntl.setPassport(
	        rCntlInfo.getOperatorUin(), 
	        rCntlInfo.getOperatorKey().c_str(),
	        rCntlInfo.getOperatorClientIP());
	
		if(const_cast<CCntlInfo&>(rCntlInfo).isRouteKeySet())	
			oCgiStubCntl.setUin(const_cast<CCntlInfo&>(rCntlInfo).getRouteKey());	
	    
	    if(oCgiStubCntl.putSvcObj(&oReq, 0) != 0)
	    {
			m_sErrMsg = "DoRequest failed.";
	        return 0xFFF1;
	    }
	    
	    // Send & Recv
		int iRetCode = 0;
		if((iRetCode = SendRecv()) != 0)
		{
			if(99 == iRetCode) // UDP & Need No Response
				return 0;
	
			std::stringstream oss;
			oss << m_lTimeout;
	        m_sErrMsg = "Send & Recv Timeout(";
			m_sErrMsg += oss.str();
			m_sErrMsg += "s) ";
			m_sErrMsg += oCgiStubCntl.GetLastErrMsg();
			return oCgiStubCntl.getCmd(); // Example : 0xf100
	    }
	    
		if(!m_poCmd->isValid(COOPERATORDAO_GETCOOPERATORMONITORMODEL_RESP_CMD_ID))
	    {
	        m_sErrMsg = "Cmd not match for COOPERATORDAO_GETCOOPERATORMONITORMODEL_RESP_CMD_ID";
	        return 0xFFF3;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    m_poCmd->getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CCooperatorDaoGetCooperatorMonitorModelResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xFFF4;
	    }
	    
			errmsg  = oResp.errmsg;
			CooperatorMonitorModelDdo  = oResp.CooperatorMonitorModelDdo;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	uint32_t CCooperatorDaoStub4Web::GetCooperatorMonitorModelList(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t cooperatorId,
				const std::string& inReserve,
				std::string& errmsg,
				std::vector<b2b2c::cooperator::ddo::CCooperatorMonitorModelDdo >& CooperatorMonitorModelDdo,
				std::string& outReserve
	)
	{
		CCgiStubCntl oCgiStubCntl;
		oCgiStubCntl.Initialize_r();
		this->SetCgiStubCntl(&oCgiStubCntl);
	
	    CCooperatorDaoGetCooperatorMonitorModelListReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.cooperatorId = cooperatorId;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.CooperatorMonitorModelDdo = CooperatorMonitorModelDdo;
			oReq.outReserve = outReserve;
	
	    oCgiStubCntl.setPassport(
	        rCntlInfo.getOperatorUin(), 
	        rCntlInfo.getOperatorKey().c_str(),
	        rCntlInfo.getOperatorClientIP());
	
		if(const_cast<CCntlInfo&>(rCntlInfo).isRouteKeySet())	
			oCgiStubCntl.setUin(const_cast<CCntlInfo&>(rCntlInfo).getRouteKey());	
	    
	    if(oCgiStubCntl.putSvcObj(&oReq, 0) != 0)
	    {
			m_sErrMsg = "DoRequest failed.";
	        return 0xFFF1;
	    }
	    
	    // Send & Recv
		int iRetCode = 0;
		if((iRetCode = SendRecv()) != 0)
		{
			if(99 == iRetCode) // UDP & Need No Response
				return 0;
	
			std::stringstream oss;
			oss << m_lTimeout;
	        m_sErrMsg = "Send & Recv Timeout(";
			m_sErrMsg += oss.str();
			m_sErrMsg += "s) ";
			m_sErrMsg += oCgiStubCntl.GetLastErrMsg();
			return oCgiStubCntl.getCmd(); // Example : 0xf100
	    }
	    
		if(!m_poCmd->isValid(COOPERATORDAO_GETCOOPERATORMONITORMODELLIST_RESP_CMD_ID))
	    {
	        m_sErrMsg = "Cmd not match for COOPERATORDAO_GETCOOPERATORMONITORMODELLIST_RESP_CMD_ID";
	        return 0xFFF3;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    m_poCmd->getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CCooperatorDaoGetCooperatorMonitorModelListResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xFFF4;
	    }
	    
			errmsg  = oResp.errmsg;
			CooperatorMonitorModelDdo  = oResp.CooperatorMonitorModelDdo;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	uint32_t CCooperatorDaoStub4Web::SetCooperatorInfo(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint64_t option,
				const b2b2c::cooperator::ddo::CCooperatorSetDdo& cooperatorSetDdo,
				const std::string& inReserve,
				std::string& errmsg,
				std::string& outReserve
	)
	{
		CCgiStubCntl oCgiStubCntl;
		oCgiStubCntl.Initialize_r();
		this->SetCgiStubCntl(&oCgiStubCntl);
	
	    CCooperatorDaoSetCooperatorInfoReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.option = option;
			oReq.cooperatorSetDdo = cooperatorSetDdo;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.outReserve = outReserve;
	
	    oCgiStubCntl.setPassport(
	        rCntlInfo.getOperatorUin(), 
	        rCntlInfo.getOperatorKey().c_str(),
	        rCntlInfo.getOperatorClientIP());
	
		if(const_cast<CCntlInfo&>(rCntlInfo).isRouteKeySet())	
			oCgiStubCntl.setUin(const_cast<CCntlInfo&>(rCntlInfo).getRouteKey());	
	    
	    if(oCgiStubCntl.putSvcObj(&oReq, 0) != 0)
	    {
			m_sErrMsg = "DoRequest failed.";
	        return 0xFFF1;
	    }
	    
	    // Send & Recv
		int iRetCode = 0;
		if((iRetCode = SendRecv()) != 0)
		{
			if(99 == iRetCode) // UDP & Need No Response
				return 0;
	
			std::stringstream oss;
			oss << m_lTimeout;
	        m_sErrMsg = "Send & Recv Timeout(";
			m_sErrMsg += oss.str();
			m_sErrMsg += "s) ";
			m_sErrMsg += oCgiStubCntl.GetLastErrMsg();
			return oCgiStubCntl.getCmd(); // Example : 0xf100
	    }
	    
		if(!m_poCmd->isValid(COOPERATORDAO_SETCOOPERATORINFO_RESP_CMD_ID))
	    {
	        m_sErrMsg = "Cmd not match for COOPERATORDAO_SETCOOPERATORINFO_RESP_CMD_ID";
	        return 0xFFF3;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    m_poCmd->getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CCooperatorDaoSetCooperatorInfoResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xFFF4;
	    }
	    
			errmsg  = oResp.errmsg;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	uint32_t CCooperatorDaoStub4Web::SetCooperatorPassWd(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint64_t cooperatorId,
				const std::string& cooperatorOldPassword,
				const std::string& cooperatorNewPassword,
				const std::string& inReserve,
				std::string& errmsg,
				std::string& outReserve
	)
	{
		CCgiStubCntl oCgiStubCntl;
		oCgiStubCntl.Initialize_r();
		this->SetCgiStubCntl(&oCgiStubCntl);
	
	    CCooperatorDaoSetCooperatorPassWdReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.cooperatorId = cooperatorId;
			oReq.cooperatorOldPassword = cooperatorOldPassword;
			oReq.cooperatorNewPassword = cooperatorNewPassword;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.outReserve = outReserve;
	
	    oCgiStubCntl.setPassport(
	        rCntlInfo.getOperatorUin(), 
	        rCntlInfo.getOperatorKey().c_str(),
	        rCntlInfo.getOperatorClientIP());
	
		if(const_cast<CCntlInfo&>(rCntlInfo).isRouteKeySet())	
			oCgiStubCntl.setUin(const_cast<CCntlInfo&>(rCntlInfo).getRouteKey());	
	    
	    if(oCgiStubCntl.putSvcObj(&oReq, 0) != 0)
	    {
			m_sErrMsg = "DoRequest failed.";
	        return 0xFFF1;
	    }
	    
	    // Send & Recv
		int iRetCode = 0;
		if((iRetCode = SendRecv()) != 0)
		{
			if(99 == iRetCode) // UDP & Need No Response
				return 0;
	
			std::stringstream oss;
			oss << m_lTimeout;
	        m_sErrMsg = "Send & Recv Timeout(";
			m_sErrMsg += oss.str();
			m_sErrMsg += "s) ";
			m_sErrMsg += oCgiStubCntl.GetLastErrMsg();
			return oCgiStubCntl.getCmd(); // Example : 0xf100
	    }
	    
		if(!m_poCmd->isValid(COOPERATORDAO_SETCOOPERATORPASSWD_RESP_CMD_ID))
	    {
	        m_sErrMsg = "Cmd not match for COOPERATORDAO_SETCOOPERATORPASSWD_RESP_CMD_ID";
	        return 0xFFF3;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    m_poCmd->getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CCooperatorDaoSetCooperatorPassWdResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xFFF4;
	    }
	    
			errmsg  = oResp.errmsg;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	uint32_t CCooperatorDaoStub4Web::SetCooperatorPro(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint64_t option,
				const b2b2c::cooperator::ddo::CCooperatorProDdo& cooperatorProDdo,
				const std::string& inReserve,
				std::string& errmsg,
				std::string& outReserve
	)
	{
		CCgiStubCntl oCgiStubCntl;
		oCgiStubCntl.Initialize_r();
		this->SetCgiStubCntl(&oCgiStubCntl);
	
	    CCooperatorDaoSetCooperatorProReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.option = option;
			oReq.cooperatorProDdo = cooperatorProDdo;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.outReserve = outReserve;
	
	    oCgiStubCntl.setPassport(
	        rCntlInfo.getOperatorUin(), 
	        rCntlInfo.getOperatorKey().c_str(),
	        rCntlInfo.getOperatorClientIP());
	
		if(const_cast<CCntlInfo&>(rCntlInfo).isRouteKeySet())	
			oCgiStubCntl.setUin(const_cast<CCntlInfo&>(rCntlInfo).getRouteKey());	
	    
	    if(oCgiStubCntl.putSvcObj(&oReq, 0) != 0)
	    {
			m_sErrMsg = "DoRequest failed.";
	        return 0xFFF1;
	    }
	    
	    // Send & Recv
		int iRetCode = 0;
		if((iRetCode = SendRecv()) != 0)
		{
			if(99 == iRetCode) // UDP & Need No Response
				return 0;
	
			std::stringstream oss;
			oss << m_lTimeout;
	        m_sErrMsg = "Send & Recv Timeout(";
			m_sErrMsg += oss.str();
			m_sErrMsg += "s) ";
			m_sErrMsg += oCgiStubCntl.GetLastErrMsg();
			return oCgiStubCntl.getCmd(); // Example : 0xf100
	    }
	    
		if(!m_poCmd->isValid(COOPERATORDAO_SETCOOPERATORPRO_RESP_CMD_ID))
	    {
	        m_sErrMsg = "Cmd not match for COOPERATORDAO_SETCOOPERATORPRO_RESP_CMD_ID";
	        return 0xFFF3;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    m_poCmd->getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CCooperatorDaoSetCooperatorProResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xFFF4;
	    }
	    
			errmsg  = oResp.errmsg;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	uint32_t CCooperatorDaoStub4Web::UpdateCooperatorBaseInfo(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				const b2b2c::cooperator::ddo::CCooperatorBaseInfoDdo& cooperatorBaseInfoDdo,
				const std::string& inReserve,
				std::string& errmsg,
				std::string& outReserve
	)
	{
		CCgiStubCntl oCgiStubCntl;
		oCgiStubCntl.Initialize_r();
		this->SetCgiStubCntl(&oCgiStubCntl);
	
	    CCooperatorDaoUpdateCooperatorBaseInfoReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.cooperatorBaseInfoDdo = cooperatorBaseInfoDdo;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.outReserve = outReserve;
	
	    oCgiStubCntl.setPassport(
	        rCntlInfo.getOperatorUin(), 
	        rCntlInfo.getOperatorKey().c_str(),
	        rCntlInfo.getOperatorClientIP());
	
		if(const_cast<CCntlInfo&>(rCntlInfo).isRouteKeySet())	
			oCgiStubCntl.setUin(const_cast<CCntlInfo&>(rCntlInfo).getRouteKey());	
	    
	    if(oCgiStubCntl.putSvcObj(&oReq, 0) != 0)
	    {
			m_sErrMsg = "DoRequest failed.";
	        return 0xFFF1;
	    }
	    
	    // Send & Recv
		int iRetCode = 0;
		if((iRetCode = SendRecv()) != 0)
		{
			if(99 == iRetCode) // UDP & Need No Response
				return 0;
	
			std::stringstream oss;
			oss << m_lTimeout;
	        m_sErrMsg = "Send & Recv Timeout(";
			m_sErrMsg += oss.str();
			m_sErrMsg += "s) ";
			m_sErrMsg += oCgiStubCntl.GetLastErrMsg();
			return oCgiStubCntl.getCmd(); // Example : 0xf100
	    }
	    
		if(!m_poCmd->isValid(COOPERATORDAO_UPDATECOOPERATORBASEINFO_RESP_CMD_ID))
	    {
	        m_sErrMsg = "Cmd not match for COOPERATORDAO_UPDATECOOPERATORBASEINFO_RESP_CMD_ID";
	        return 0xFFF3;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    m_poCmd->getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CCooperatorDaoUpdateCooperatorBaseInfoResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xFFF4;
	    }
	    
			errmsg  = oResp.errmsg;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	uint32_t CCooperatorDaoStub4Web::UpdateCooperatorLicense(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				const b2b2c::cooperator::ddo::CCooperatorLicenseDdo& cooperatorLicenseDdo,
				const std::string& inReserve,
				std::string& errmsg,
				std::string& outReserve
	)
	{
		CCgiStubCntl oCgiStubCntl;
		oCgiStubCntl.Initialize_r();
		this->SetCgiStubCntl(&oCgiStubCntl);
	
	    CCooperatorDaoUpdateCooperatorLicenseReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.cooperatorLicenseDdo = cooperatorLicenseDdo;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.outReserve = outReserve;
	
	    oCgiStubCntl.setPassport(
	        rCntlInfo.getOperatorUin(), 
	        rCntlInfo.getOperatorKey().c_str(),
	        rCntlInfo.getOperatorClientIP());
	
		if(const_cast<CCntlInfo&>(rCntlInfo).isRouteKeySet())	
			oCgiStubCntl.setUin(const_cast<CCntlInfo&>(rCntlInfo).getRouteKey());	
	    
	    if(oCgiStubCntl.putSvcObj(&oReq, 0) != 0)
	    {
			m_sErrMsg = "DoRequest failed.";
	        return 0xFFF1;
	    }
	    
	    // Send & Recv
		int iRetCode = 0;
		if((iRetCode = SendRecv()) != 0)
		{
			if(99 == iRetCode) // UDP & Need No Response
				return 0;
	
			std::stringstream oss;
			oss << m_lTimeout;
	        m_sErrMsg = "Send & Recv Timeout(";
			m_sErrMsg += oss.str();
			m_sErrMsg += "s) ";
			m_sErrMsg += oCgiStubCntl.GetLastErrMsg();
			return oCgiStubCntl.getCmd(); // Example : 0xf100
	    }
	    
		if(!m_poCmd->isValid(COOPERATORDAO_UPDATECOOPERATORLICENSE_RESP_CMD_ID))
	    {
	        m_sErrMsg = "Cmd not match for COOPERATORDAO_UPDATECOOPERATORLICENSE_RESP_CMD_ID";
	        return 0xFFF3;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    m_poCmd->getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CCooperatorDaoUpdateCooperatorLicenseResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xFFF4;
	    }
	    
			errmsg  = oResp.errmsg;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	uint32_t CCooperatorDaoStub4Web::UpdateCooperatorMonitorModel(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				const b2b2c::cooperator::ddo::CCooperatorMonitorModelDdo& CooperatorMonitorModelDdo,
				const std::string& inReserve,
				std::string& errmsg,
				std::string& outReserve
	)
	{
		CCgiStubCntl oCgiStubCntl;
		oCgiStubCntl.Initialize_r();
		this->SetCgiStubCntl(&oCgiStubCntl);
	
	    CCooperatorDaoUpdateCooperatorMonitorModelReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.CooperatorMonitorModelDdo = CooperatorMonitorModelDdo;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.outReserve = outReserve;
	
	    oCgiStubCntl.setPassport(
	        rCntlInfo.getOperatorUin(), 
	        rCntlInfo.getOperatorKey().c_str(),
	        rCntlInfo.getOperatorClientIP());
	
		if(const_cast<CCntlInfo&>(rCntlInfo).isRouteKeySet())	
			oCgiStubCntl.setUin(const_cast<CCntlInfo&>(rCntlInfo).getRouteKey());	
	    
	    if(oCgiStubCntl.putSvcObj(&oReq, 0) != 0)
	    {
			m_sErrMsg = "DoRequest failed.";
	        return 0xFFF1;
	    }
	    
	    // Send & Recv
		int iRetCode = 0;
		if((iRetCode = SendRecv()) != 0)
		{
			if(99 == iRetCode) // UDP & Need No Response
				return 0;
	
			std::stringstream oss;
			oss << m_lTimeout;
	        m_sErrMsg = "Send & Recv Timeout(";
			m_sErrMsg += oss.str();
			m_sErrMsg += "s) ";
			m_sErrMsg += oCgiStubCntl.GetLastErrMsg();
			return oCgiStubCntl.getCmd(); // Example : 0xf100
	    }
	    
		if(!m_poCmd->isValid(COOPERATORDAO_UPDATECOOPERATORMONITORMODEL_RESP_CMD_ID))
	    {
	        m_sErrMsg = "Cmd not match for COOPERATORDAO_UPDATECOOPERATORMONITORMODEL_RESP_CMD_ID";
	        return 0xFFF3;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    m_poCmd->getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CCooperatorDaoUpdateCooperatorMonitorModelResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xFFF4;
	    }
	    
			errmsg  = oResp.errmsg;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}

